package com.example.mobile2021606127cxz0323;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    EditText edtTxtaccount;
    EditText edtTxtpsw;
    EditText edtTxtpsw2;
    Button btnzhuce;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        edtTxtaccount=(EditText)findViewById(R.id.edtTxt_main_account);
        edtTxtpsw=(EditText)findViewById(R.id.edtTxt_main_psw);
        edtTxtpsw2=(EditText)findViewById(R.id.edtTxt_main_psw2);
        btnzhuce=(Button)findViewById(R.id.btn_main_zhuce);

        btnzhuce.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String zhanghao=((EditText) findViewById(R.id.edtTxt_main_account)).getText().toString().trim();
                String psw=((EditText) findViewById(R.id.edtTxt_main_psw)).getText().toString().trim();
                String psw2=((EditText) findViewById(R.id.edtTxt_main_psw2)).getText().toString().trim();
                Log.e("infor", "获取到的信息为: "+"账号："+zhanghao +"     "+ "第一次输入的密码:"+psw +"     " + "第二次输入的密码："+psw2);
                if(psw.length()==psw2.length()){
                   Toast.makeText(MainActivity.this,"注册成功",Toast.LENGTH_SHORT).show();
                }else {
                    Toast.makeText(MainActivity.this,"两次的密码不一致",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}